package util;

import dto.EmployeeDTO;
import entities.Employee;

public class Conversion {
	

	

	

	

	

	


	
	

	public Employee fromEmployeeDTOToEmployee(EmployeeDTO eDTO) throws Exception {
		try {
			Employee e = new Employee();
			e.setEmail(eDTO.getEmail());
			e.setId(eDTO.getId());
			e.setPassword(eDTO.getPassword());
			e.setRank(eDTO.getRank());
			e.setUsername(eDTO.getUsername());
			
//		    List<InterviewDTO> li = eDTO.getInterviews();
//			List<Interview> l = new ArrayList<Interview>();
//			for (InterviewDTO i : li)
//				l.add(fromInterviewDTOToInterview(i));
//
//			e.setInterviews(l);
			

			return e;
		} catch (Exception e) {
			throw new Exception("Couldn't convert from EmployeeDTO to Employee", e);
		}
	}

	
	public EmployeeDTO fromEmployeeToEmployeeDTO(Employee em) throws Exception {
		try {
			EmployeeDTO eDTO = new EmployeeDTO();
			eDTO.setId(em.getId());
			eDTO.setUsername(em.getUsername());
			eDTO.setPassword(em.getPassword());
			eDTO.setRank(em.getRank());
			eDTO.setEmail(em.getEmail());
			

			System.out.println(eDTO.getPassword());
			System.out.println(eDTO.getEmail());
			System.out.println(eDTO.getRank());
			System.out.println(eDTO.getId());
			System.out.println(eDTO.getUsername());
			return eDTO;
		}

		catch (Exception e) {
			throw new Exception("Couldn't convert from Employee to EmployeeDTO", e);
		}

	}

}
